<%@ page contentType="text/html;charset=UTF-8" language="java" pageEncoding="utf-8" %>
<%@taglib prefix="accessory" uri="http://accessoryPackageTag.weitu.net" %>
<%@taglib uri="http://workflowReviewTag.weitu.net" prefix="flow" %>
<!doctype html>
<html lang="zh">
<head>
    <title>业务表单</title>
    <%@include file="/common/header.jspf" %>
    <script type="text/javascript">
        var loginUserName = '${loginUser.name}';
        var loginUserId = '${loginUser.id}';
        var businessId = '${info.id}';
    </script>
    <SCRIPT src="${ctx}/resources/js/accidentEvent/event/verify.js" type="text/javascript"></SCRIPT>
    <style>
        .flow_review {

            width: 100%;
            margin-bottom: 20px;
        }

        .flow_review .review_title {
            width: 100px;
            text-align: right;
        }

        .flow_review > table {
            width: 100%;
        }

        .flow_review label {
            float: left;
            width: 50px;
        }

        .flow_review label > input {
            width: 10px;
        }

        .flow_review textarea {
            width: 80%;
        }

        .flow_review .review_next_check {
            width: 100%;
        }

        /*.flow_review .review_result{
            padding-left:20%;
            height:30px;
            line-height:30px;
        }
        .flow_review .review_result>label{
            width:50px;
            float:left;
        }
        .flow_review .review_result>label>input{
            width:10px;
        }
        .flow_review  .review_comments{
            height:auto;
        }
        .flow_review  .review_comments>textarea{
            margin-left:10%;
            width:80%;
        }*/
    </style>
</head>
<body>
<div class="menu-right" style="">
    <a class="button icon-save" id="btn_save">
        保存
    </a>
    <%--<a class="button icon-refer" id="">
       提交
   </a>--%>
    <%--<a class="button icon-export">
        导入
    </a>--%>
</div>
<form id="infoForm" method="post">
    <input type="hidden" name="id" value="${info.id}">
    <div class="information">
        <div class="information-title">
            <p>事件基本信息</p>
            <a class="panel-down" href="javascript:void(0)">
                <span style="color: #49A9F9" class="fa fa-chevron-down fa-lg"></span>
            </a>
        </div>
        <div class="cuttle" style="">
            <div style="clear: both">
                <div class="form_one" style="">
                    <label class="lable-style">事件名称:</label>
                    <input type="text" class="easyui-textbox" style="width: 240px;" required="true" name="name"
                           value="${info.name}" readonly>
                    <span>*</span>
                </div>
                <div class="form_one">
                    <label class="lable-style">事件发生单位:</label>
                    <input id="happenDeptId" class="easyui-textbox" style="width: 240px;" required="true"
                           editable="false" validType="validSelect" name="deptId" value="${info.deptId}" readonly>
                    <span>*</span>
                </div>
                <div class="form_one">
                    <label class="lable-style">事件发生时间:</label>
                    <input class="easyui-datebox" style="width: 240px;" editable="false" name="happenTime"
                           required="true" value="${info.happenTime}" readonly>
                    <span>*</span>
                </div>
            </div>
            <div style="clear: both">
                <div class="form_one">
                    <label class="lable-style">是否选择工厂模式:</label>
                    <select class="easyui-combobox" style="width: 240px;" id="isFactoryModel" name="isFactoryModel"
                            editable="false" panelHeight="50" readonly>
                        <option value="1"
                                <c:if test="${info.isFactoryModel eq 1}">selected</c:if> >是
                        </option>
                        <option value="0"
                                <c:if test="${info.isFactoryModel eq 0}">selected</c:if> >否
                        </option>
                    </select>
                    <span>*</span>
                </div>
                <div class="form_one" id="siteIdDiv">
                    <label class="lable-style">事故发生地点:</label>
                    <input id="siteId" name="siteId" type="hidden" value="${info.siteId}">
                    <input id="site" name="site" editable="false" class="easyui-textbox" required="true"
                           validType="validSelect" style="width: 240px;" value="${info.siteIdName}" readonly>
                    <span>*</span>
                </div>
                <div class="form_one" id="siteNameDiv" style="display: none;">
                    <label class="lable-style">事故发生地点:</label>
                    <input id="siteName" name="siteName" class="easyui-textbox" required="true" style="width: 240px"
                           value="${info.siteName}" readonly>
                    <span>*</span>
                </div>
                <div class="form_one">
                    <label class="lable-style">具体部位:</label>
                    <input id="specificSite" name="specificSite" class="easyui-textbox" style="width: 240px;"
                           value="${info.specificSite}" readonly>
                </div>
            </div>
            <div style="clear: both">
                <div class="form_one">
                    <label class="lable-style">是否承包商事故:</label>
                    <select class="easyui-combobox" style="width: 240px;" id="isContractor" name="isContractor"
                            panelHeight="50" editable="false" readonly>
                        <option value="1"
                                <c:if test="${info.isContractor eq 1}">selected</c:if> >是
                        </option>
                        <option value="0" <c:if test="${info.isContractor eq 0}">selected</c:if>>否</option>
                    </select>
                    <span>*</span>
                </div>
                <div class="form_one" id="contractorDiv" style="display: none;">
                    <label class="lable-style">承包商名称:</label>
                    <input id="contractorId" name="contractorId" type="hidden" value="${info.contractorId}">
                    <input id="contractor" editable="false" class="easyui-textbox" required="true"
                           validType="validSelect" style="width: 240px;" value="${info.contractorName}" readonly>
                    <span>*</span>
                </div>
            </div>

            <div style="clear: both">
                <div class="form_one fotm-textarea" style="margin-bottom: 5px;height: 100px;">
                    <label class="lable-style">事件内容描述:</label>
                    <input class="easyui-textbox" data-options="multiline:true" required
                           style="height: 100px;width: 598px;" name="contentDescription"
                           value="${info.contentDescription}" readonly/>
                    <span>*</span>
                </div>
            </div>
            <div style="clear: both;height:57px;">
                <div class="form_one">
                    <label class="lable-style">与工作有关:</label>
                    <select class="easyui-combobox" value="0" style="width: 240px;" required="true" name="isJobRelated"
                            panelHeight="50px" editable="false" readonly>
                        <option value="1"
                                <c:if test="${info.isJobRelated eq 1}">selected</c:if> >是
                        </option>
                        <option value="0"
                                <c:if test="${info.isJobRelated eq 0}">selected</c:if> >否
                        </option>
                    </select>
                    <span>*</span>
                </div>
                <div class="form_one">
                    <label class="lable-style">作业环节:</label>
                    <input id="jobStepId" class="easyui-combobox" style="width: 240px;" required="true" name="jobStepId"
                           value="${info.jobStepId}"
                           editable="false" readonly/>
                </div>
                <div class="form_one">
                    <label class="lable-style">作业活动:</label>
                    <input id="jobActivityId" class="easyui-combobox" style="width: 240px;" name="jobActivityId"
                           validType="validSelect"
                           required editable="false" value="${info.jobActivityId}" readonly/>
                    <span>*</span>
                </div>
            </div>
        </div>
    </div>
    <div class="information">
        <div class="information-title">
            <p>人员伤亡信息</p>
            <a class="panel-down" href="javascript:void(0)">
                <span style="color: #49A9F9" class="fa fa-chevron-down fa-lg"></span>
            </a>
        </div>
        <div class="enclosure" style="height:300px; ">
            <table id="casualtiesList">
            </table>
        </div>
        <div style="clear: both;height:57px;">
            <div class="form_one">
                <label class="lable-style">死亡人数:</label>
                <input id="dieNum" class="easyui-textbox" name="dieNum" value="${info.dieNum}" style="width: 240px;"
                       readonly/>
                <span>*</span>
            </div>
            <div class="form_one">
                <label class="lable-style">损失工作日人数:</label>
                <input id="lossWorkDayNum" class="easyui-numberspinner" validType="int" value="${info.lossWorkDayNum}"
                       style="width: 240px;" required="true" name="lossWorkDayNum"
                       data-options="min:0" readonly/>
                <span>*</span>
            </div>
            <div class="form_one">
                <label class="lable-style">工作受限人数:</label>
                <input id="workLimitedNum" class="easyui-numberspinner" value="${info.workLimitedNum}"
                       style="width: 240px;" required="true" name="workLimitedNum"
                       data-options="min:0" readonly/>
                <span>*</span>
            </div>
        </div>

        <div style="clear: both;height:57px;">
            <div class="form_one">
                <label class="lable-style">医疗处理人数:</label>
                <input id="medicalCareNum" class="easyui-numberspinner" value="${info.medicalCareNum}"
                       style="width: 240px;" required="true" name="medicalCareNum"
                       data-options="min:0" readonly/>
                <span>*</span>
            </div>
            <div class="form_one">
                <label class="lable-style">失去知觉人数:</label>
                <input id="lossConsciousnessNum" class="easyui-numberspinner" value="${info.lossConsciousnessNum}"
                       style="width: 240px;" required="true" name="lossConsciousnessNum"
                       data-options="min:0" readonly/>
                <span>*</span>
            </div>
            <div class="form_one">
                <label class="lable-style">其他伤害人数:</label>
                <input id="otherDamageNum" class="easyui-numberspinner" value="${info.otherDamageNum}"
                       style="width: 240px;" required="true" name="otherDamageNum"
                       data-options="min:0" readonly/>
                <span>*</span>
            </div>
        </div>
        <div style="clear: both;height:57px;">
            <div class="form_one">
                <label class="lable-style">简单医疗处理人数:</label>
                <input id="simpleMedicalCareNum" class="easyui-numberspinner" value="${info.simpleMedicalCareNum}"
                       style="width: 240px;" required="true" name="simpleMedicalCareNum"
                       data-options="min:0" readonly/>
                <span>*</span>
            </div>
            <div class="form_one">
                <label class="lable-style">火灾或爆炸级别:</label>
                <input id="fireOrExplosionLevelId" class="easyui-combobox" style="width: 240px;"
                       name="fireOrExplosionLevelId"
                       editable="false" value="${info.fireOrExplosionLevelId}" readonly/>
            </div>
            <div class="form_one">
                <label class="lable-style">损失（万元）:</label>
                <input class="easyui-numberspinner" value="${info.loss}" style="width: 240px;" required="true"
                       name="loss"
                       data-options="min:0,precision:2" readonly/>
                <span>*</span>
            </div>
        </div>
        <div style="clear: both;height:57px;">
            <div class="form_one">
                <label class="lable-style">油气或化学品泄漏（吨）:</label>
                <input class="easyui-numberspinner" value="${info.leakQuantity}" style="width: 240px;"
                       name="leakQuantity"
                       data-options="min:0" readonly/>
            </div>
            <div class="form_one">
                <label class="lable-style">油气或化学品回收（吨）:</label>
                <input class="easyui-numberspinner" value="${info.recycleQuantity}" style="width: 240px;"
                       required="true" name="recycleQuantity"
                       data-options="min:0" readonly/>
            </div>
            <div class="form_one">
                <label class="lable-style">泄漏级别:</label>
                <input id="leakLevelId" class="easyui-combobox" style="width: 240px;" name="leakLevelId"
                       editable="false" value="${info.leakLevelId}" readonly/>
            </div>
        </div>
    </div>
    <div class="information">
        <div class="information-title">
            <p>事故原因分析</p>
            <a class="panel-down" href="javascript:void(0)">
                <span style="color: #49A9F9" class="fa fa-chevron-down fa-lg"></span>
            </a>
        </div>
        <div class="cuttle" style="">
            <div style="clear: both;height:57px;">
                <div class="form_one">
                    <label class="lable-style">人的不安全行为:</label>
                    <input id="peopleUnsafeId" class="easyui-combobox" style="width: 240px;" required="true"
                           name="peopleUnsafeId"
                           editable="false" value="${info.peopleUnsafeId}" readonly/>
                    <span>*</span>
                </div>
                <div class="form_one">
                    <label class="lable-style">物的不安全状态:</label>
                    <input id="thingUnsafeId" class="easyui-combobox" style="width: 240px;" required="true"
                           name="thingUnsafeId"
                           editable="false" value="${info.thingUnsafeId}" readonly/>
                </div>
            </div>
            <div style="clear: both;height:57px;">
                <div class="form_one">
                    <label class="lable-style">工作因素:</label>
                    <input id="workElementId" class="easyui-combobox" style="width: 240px;" name="workElementId"
                           editable="false" value="${info.workElementId}" readonly/>
                </div>
                <div class="form_one">
                    <label class="lable-style">个人因素:</label>
                    <input id="personalElementId" class="easyui-combobox" style="width: 240px;" name="personalElementId"
                           editable="false" value="${info.personalElementId}" readonly/>
                </div>
                <div class="form_one">
                    <label class="lable-style">工作环境:</label>
                    <input id="workEnvironmentId" class="easyui-combobox" style="width: 240px;" name="workEnvironmentId"
                           editable="false" value="${info.workEnvironmentId}" readonly/>
                </div>
            </div>
            <div style="clear: both">
                <div class="form_one fotm-textarea" style="margin-bottom: 5px;height: 100px;">
                    <label class="lable-style">拟采取的工作措施:</label>
                    <input class="easyui-textbox" data-options="multiline:true" style="height: 100px;width: 598px;"
                           name="planWorkMeasure" value="${info.planWorkMeasure}" readonly/>
                </div>
            </div>
        </div>
    </div>
    <div class="information">
        <div class="information-title">
            <p>相关附件</p>
            <a class="panel-down" href="javascript:void(0)">
                <span style="color: #49A9F9" class="fa fa-chevron-down fa-lg"></span>
            </a>
        </div>
        <div class="cuttle" style="margin-bottom: 20px;">
            <accessory:accessorySimple permission="" packageInfos="${accessoryList}" packageKey="sgfj"
                                       uploadUserId="${loginUser.id}"
                                       accessoryType="txt,docx,doc,xls,xlsx,jpg,png"></accessory:accessorySimple>
        </div>
    </div>
</form>
<%--审核信息--%>
<form id="verifyForm">
    <input type="hidden" name="businessId" value="${info.id}">
    <input type="hidden" name="workItemId" value="${workItemId}"/>
    <input type="hidden" name="step" value="${step}"/>
    <div class="information" style="">
        <div class="information-title">
            <p>审批信息</p>
            <a href="#"><img src="${ctx}/resources/themes/images/alias_03.png" width="18"></a>
        </div>
        <div class="input-wrap">
            <!--工作流审批意见-->
            <flow:review requestName="workflowReview" workItemId="${workItemId}"/>
        </div>
    </div>
</form>
</body>
<script type="text/javascript">
    $(function () {
        /***
         * 审批操作
         */
        $('#btn_save').on("click", function () {

            $.messager.progress();	// 显示进度条
            var data = $("#verifyForm").serializeJson();
            if (!checkVerifyResult('workflowReview')) {
                $.messager.progress('close');
                return false;
            }
            //表单提交
            $('#verifyForm').form('submit', {
                url: ROOT_PATH + '/accidentEvent/event/verifyApplication.shtml',
                data: data,
                onSubmit: function (param) {
                    return true;	// 返回false终止表单提交
                },
                success: function (result) {
                    try {
                        result = $.parseJSON(result);
                    } catch (e) {
                        $.messager.progress('close');
                        parent.layer.msg(result.message, {time: 1000, icon: 2});
                    }
                    if (result.success) {
                        $.messager.progress('close');	// 如果提交成功则隐藏进度条
                        parent.layer.msg(result.message, {time: 1000, icon: 1}, function () {
                            WindowManager.closeLayer();//关闭窗口
                        });
                    } else {
                        $.messager.progress('close');	// 如果提交失败则不做处理
                        parent.layer.msg(result.message, {time: 1000, icon: 2});
                    }
                }
            });
        });
    });
</script>
</html>
